<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Middleman_Acl
 *
 * @author tann
 */
class Middleman_Acl extends Zend_Acl {

    public function __construct(Zend_Auth $auth) {
        //Declare role
        $this->addRole(new Zend_Acl_Role('guest'))
                ->addRole(new Zend_Acl_Role('login'), 'guest')
                ->addRole(new Zend_Acl_Role('admin'), 'login');

        //Declare resources

        $this
                ->addResource(new Zend_Acl_Resource('index'))
                ->addResource(new Zend_Acl_Resource('user'))
                ->addResource(new Zend_Acl_Resource('project'));

        //provide right for user role
        $this->allow('login','index');
        $this->deny('login', 'user');
        $this->allow('login', 'user', array('login', 'logout','profile'));
        $this->allow('login', 'project', array('list','detail'));

        //provide right for admin role
        $this->allow('admin','user');
        $this->allow('admin','project');
    }

}

?>
